﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using NHibernate;
using NhJump.Persistence.Batching;

namespace NhJump.Persistence.Context
{
    public class AutoBoundUnitOfWork : UnitOfWork
    {
        public AutoBoundUnitOfWork(ISessionFactory factory)
            : base(factory)
        {
            UnitOfWorkBinder.Bind(this);
        }

        public AutoBoundUnitOfWork(ISessionFactory factory, IDbConnection dbConnection)
            : base(factory, dbConnection)
        {
            UnitOfWorkBinder.Bind(this);
        }

        public override void Dispose()
        {
            UnitOfWorkBinder.UnBind();

            base.Dispose();
        }
    }
}
